clear
cd "C:\Users\nprasad\Dropbox\UP Survey\Manuscript\Submission\JOP\Conditional accept"
set more off 
set varabbrev off


use Data_Daxecker_Prasad_UP_Violence.dta, replace 


////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Table II. Approval for violence 




////For Column M1 of Table II
reg y_v1 c.legitimize c.response , robust

////For Column M2 of Table II
reg y_v1 c.legitimize c.response vote_bjp resp_gen resp_obc_yadav resp_obc_nyadav resp_sc_njatav resp_muslim  age female , robust

////For Column M3 of Table II
reg y_v1 c.legitimize c.response vote_bjp resp_gen resp_obc_yadav resp_obc_nyadav resp_sc_njatav age female  if resp_hindu==1, robust

////For Column M4 of Table II
reg y_v1 c.legitimize c.response vote_bjp  age female  if resp_muslim==1, robust



////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Table III. Approval for party participating in violence 



////For Column M1 of Table III
reg y_p1 c.legitimize##c.response vote_bjp resp_hindu  age female , robust

////For Column M2 of Table III
reg y_p1 c.legitimize##c.response##c.vote_bjp##c.resp_hindu   age female , robust




////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Figure 2. Approval for BJP’s response



////For Figure 2.A: All Respondents
reg y_p1 c.legitimize##c.response vote_bjp resp_hindu  age female , robust
margins, at(legitimize=(0 1) response=(0 1) ) atmeans 
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.6)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(A: All Respondents) ytitle("Approval for BJP's response") fxsize(40)


////For Figure 2.B: Hindu BJP Voters
reg y_p1 c.legitimize##c.response##c.vote_bjp##c.resp_hindu   age female , robust
margins, at(vote_bjp=(1) legitimize=(0 1) response=(0 1) resp_hindu==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.6)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(B: Hindu BJP Voters) ytitle("Approval for BJP's response") 


////For Figure 2.C: Hindu non-BJP Voters
reg y_p1 c.legitimize##c.response##c.vote_bjp##c.resp_hindu   age female , robust
margins, at(vote_bjp=(0) legitimize=(0 1) response=(0 1)  resp_hindu==1    ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.6)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(C: Hindu non-BJP Voters) ytitle("Approval for BJP's response") 





////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Figure 3. Approval of the BJP’s response, by core and persuadable voters



////For Figure 3.A: Core Supporters (Upper Castes)
reg y_p1 c.legitimize##c.response##c.resp_gen c.vote_bjp   age  female  resp_obc_yadav resp_obc_nyadav resp_sc_njatav if resp_hindu==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_gen==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(A: Core Supporters (Upper Castes)) ytitle("Approval for BJP's response") legend(off)


////For Figure 3.B: Likely Supporters (Non-Yadav OBCs)
reg y_p1 c.legitimize##c.response##resp_obc_nyadav c.vote_bjp   age  female c.resp_gen resp_obc_yadav  resp_sc_njatav if resp_hindu==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_obc_nyadav==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "legitimize""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(B: Likely Supporters (Non-Yadav OBCs)) ytitle("Approval for BJP's response") legend(off)


////For Figure 3.C: Likely Supporters (Non-Jatav SCs)
reg y_p1 c.legitimize##c.response##resp_sc_njatav c.vote_bjp   age  female c.resp_gen resp_obc_yadav resp_obc_nyadav  if resp_hindu==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_sc_njatav==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(C: Likely Supporters (Non-Jatav SCs)) ytitle("Approval for BJP's response") legend(off)


////For Figure 3.D: BJP Voters (Upper Castes)
reg y_p1 c.legitimize##c.response##c.resp_gen c.vote_bjp   age  female  resp_obc_yadav resp_obc_nyadav resp_sc_njatav if vote_bjp==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_gen==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(D: BJP Voters (Upper Castes)) ytitle("Approval for BJP's response")


////For Figure 3.E: BJP Voters (Non-Yadav OBCs)
reg y_p1 c.legitimize##c.response##resp_obc_nyadav c.vote_bjp   age  female c.resp_gen resp_obc_yadav  resp_sc_njatav if vote_bjp==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_obc_nyadav==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(E: BJP Voters (Non-Yadav OBCs)) ytitle("Approval for BJP's response")


////For Figure 3.F: BJP Voters (Non-Jatav SCs)
reg y_p1 c.legitimize##c.response##resp_sc_njatav c.vote_bjp   age  female c.resp_gen resp_obc_yadav resp_obc_nyadav  if vote_bjp==1, robust
margins, at( legitimize=(0 1) response=(0 1) resp_sc_njatav==1     ) atmeans
marginsplot, recast(scatter)  legend(order(3 "Peace" 4 "Violence") pos(6) row(1)) xsize(5)  legend(region(lwidth(none)) subtitle("Party responds with:", size(small)) ) ylabel(-0.40(.2)0.8)  graphregion(color(white)) bgcolor(white)   xlabel(0 `""Without" "Legitimization""' 1 `""With" "Legitimization""' , labsize(small)) xtitle("") title(F: BJP Voters (Non-Jatav SCs)) ytitle("Approval for BJP's response")





////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Appendix A Descriptives & Baseline Tests



////For Table A.1. Summary statistics
sum y_v1 y_p1 legitimize response resp_gen resp_obc_yadav resp_obc_nyadav resp_sc_njatav resp_muslim  age  female 


////For Table A.2. Covariate balance

gen balancetreat=.
replace balancetreat=0 if legitimize==0 & response==0
replace balancetreat=1 if legitimize==1 & response==0
replace balancetreat=2 if legitimize==0 & response==1
replace balancetreat=3 if legitimize==1 & response==1

eststo clear
mlogit	balancetreat resp_hindu resp_muslim vote_bjp  age  female , base(0) 
est store balance


esttab balance using balance.tex,  ///
replace scalars("ll Log lik." "chi2 Chi-squared") se label  b(%9.3f) t(%9.3f) nonumber booktabs ///
title("Covariate balance." \label{tab:balance}) ///
mtitle("M1") ///
eqlabels(none) ///
mgroups("Treatment Assignment", pattern(1) ///
prefix(\multicolumn{@span}{c}{) suffix(})   ///
span erepeat(\cmidrule(lr){@span}))         ///
alignment(cr) page(dcolumn) nonumber 






////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Appendix D Supplementary Tables


////For Table D.1. Column M1
reg y_p1 c.legitimize##c.response##c.resp_gen c.vote_bjp   age  female  resp_obc_yadav resp_obc_nyadav resp_sc_njatav if resp_hindu==1, robust

////For Table D.1. Column M2
reg y_p1 c.legitimize##c.response##resp_obc_nyadav c.vote_bjp   age  female c.resp_gen resp_obc_yadav  resp_sc_njatav if resp_hindu==1, robust

////For Table D.1. Column M3
reg y_p1 c.legitimize##c.response##resp_sc_njatav c.vote_bjp   age  female c.resp_gen resp_obc_yadav resp_obc_nyadav  if resp_hindu==1, robust

////For Table D.1. Column M4
reg y_p1 c.legitimize##c.response##c.resp_gen c.vote_bjp   age  female  resp_obc_yadav resp_obc_nyadav resp_sc_njatav if vote_bjp==1, robust

////For Table D.1. Column M5
reg y_p1 c.legitimize##c.response##resp_obc_nyadav c.vote_bjp   age  female c.resp_gen resp_obc_yadav  resp_sc_njatav if vote_bjp==1, robust

////For Table D.1. Column M6
reg y_p1 c.legitimize##c.response##resp_sc_njatav c.vote_bjp   age  female c.resp_gen resp_obc_yadav resp_obc_nyadav  if vote_bjp==1, robust




////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Appendix E TABLE E.2. Approval for party participating in violence (secondary vignette)



////For Column M1 of Table E.2
reg y_p2 c.legitimize2##c.response2 vote_sp resp_muslim  age female , robust

////For Column M2 of Table E.2
reg y_p2 c.legitimize2##c.response2##c.vote_sp##c.resp_muslim   age female , robust


////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////// For Appendix F Table F.1




///////Table F.1 reports group means and ttests. 

keep if y_rv!=.
keep if y_rp!=.
keep if y_rnrp!=.

////Row 1 for Scheduled Castes, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_hindu==1 & resp_sc==1 & r_typeA==1
preserve 
keep if resp_hindu==1 & resp_sc==1 & r_typeA==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore


////Row 2 for Scheduled Castes, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_hindu==1 & resp_sc==1 & r_typeB==1
preserve 
keep if resp_hindu==1 & resp_sc==1 & r_typeB==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore


////Row 3 for Upper, Middle, and OBC Castes, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_hindu==1 & resp_sc==0 & r_typeA==1
preserve 
keep if resp_hindu==1 & resp_sc==0 & r_typeA==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore


////Row 4 for Upper, Middle, and OBC Castes, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_hindu==1 & resp_sc==0 & r_typeB==1
preserve 
keep if resp_hindu==1 & resp_sc==0 & r_typeB==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore


////Row 5 for Muslims, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_muslim==1  & r_typeA==1
preserve 
keep if resp_muslim==1 & r_typeA==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore


////Row 6 for Muslims, Table F.1 
sum y_rv y_rp y_rnrp y_r_VoverP y_r_VoverNR  if resp_muslim==1  & r_typeB==1
preserve 
keep if resp_muslim==1 & r_typeB==1
ttest y_rv == y_rp
ttest y_rv == y_rnrp
restore
































